home *** CD-ROM | disk | FTP | other *** search
AmigaBASIC Source Code | 1986-09-04 | 3.0 KB | 146 lines | [MSBC/MSBB] |
- ' SAMPLE DEMO
- ' MacTutor©1986
- ' By Dave Kelly
-
- DEFINT A-z
- LIBRARY "Samplelib"
- filerefnum%=0
- openresfile! "Ram Disk:System Folder:System",filerefnum%
- changecursor! 4
- DIM Font(127),Font$(127),Check(127),Pt(1),Rect(3),Sizecheck(6)
- hand!=0:id%=0:type$="FONT":A$="":x%=0
- fontstyle9=0:fontstyle10=0:fontstyle12=0
- fontstyle14=0:fontstyle18=0:fontstyle24=0
- Result=0
- X1=50:Y1=130:X2=460:Y2=240
- False=0:True=NOT False
- WINDOW 1,"Untitled",(X1,Y1)-(X2,Y2)
- MENU 1,0,1,"File"
- MENU 1,1,1,"New"
- MENU 1,2,1,"Open"
- MENU 1,3,1,"Close"
- MENU 1,4,1,"Save"
- MENU 1,5,1,"Save As..."
- MENU 1,6,1,"Quit"
- MENU 3,0,1,"Font"
- MENU 4,0,1,"Size"
- MENU 5,0,0,""
- GetFonts:
- ON ERROR GOTO 9000
- I=1
- FOR x%=0 TO 127
- GetIndRes! "FONT",x%,hand!
- GetResInfo! hand!,id%,type$,A$
- IF LEN(A$) THEN Font$(I)=A$:Font(I)=id%:I=I+1:A$="":id%=0
- 10 NEXT x%
- ON ERROR GOTO 0
- NumberofFonts=I-1
- SortString! NumberofFonts,Font$(1),Font(1)
- FOR J=1 TO NumberofFonts
- IF Font$(J)="Geneva" THEN Check(J)=2 :ELSE Check(J)=1
- IF Font$(J)="Geneva" THEN g=Font(I)/128
- MENU 3,J,Check(J),Font$(J)
- NEXT J
- REALFONT! g,9,fontstyle9
- REALFONT! g,10,fontstyle10
- REALFONT! g,12,fontstyle12
- REALFONT! g,14,fontstyle14
- REALFONT! g,18,fontstyle18
- REALFONT! g,24,fontstyle24
- FOR J=1 TO 6
- Sizecheck(J)=1
- NEXT J
- Sizecheck(3)=2
- GOSUB Fontsizemenu
- <0xca564e0,0xca54010> (2)
- <0xca56520,0xca54010> (12)
- ON MENU GOSUB menuevent
- MENU ON
- <0xca565e0,0xca54010>
- loop:
- Wx=WINDOW(2):Wy=WINDOW(3)
- SetRect! Rect(0),0,0,Wx,Wy
- x=MOUSE(0):Pt(1)=MOUSE(1):Pt(0)=MOUSE(2)
- PtInRect! Pt(0),Rect(0),Result
- IF Result=False THEN <0x1a,0xca54010> :ELSE changecursor! 1
- GOTO loop
- Fontsizemenu:
- MENU OFF
- MENU 4,1,Sizecheck(1),"9 Point":SetItemStyle! 4,1,0
- MENU 4,2,Sizecheck(2),"10 Point":SetItemStyle! 4,2,0
- MENU 4,3,Sizecheck(3),"12 Point":SetItemStyle! 4,3,0
- MENU 4,4,Sizecheck(4),"14 Point":SetItemStyle! 4,4,0
- MENU 4,5,Sizecheck(5),"18 Point":SetItemStyle! 4,5,0
- MENU 4,6,Sizecheck(6),"24 Point":SetItemStyle! 4,6,0
- IF fontstyle9 = True THEN SetItemStyle! 4,1,8
- IF fontstyle10 = True THEN SetItemStyle! 4,2,8
- IF fontstyle12 = True THEN SetItemStyle! 4,3,8
- IF fontstyle14 = True THEN SetItemStyle! 4,4,8
- IF fontstyle18 = True THEN SetItemStyle! 4,5,8
- IF fontstyle24 = True THEN SetItemStyle! 4,6,8
- MENU ON
- RETURN
- menuevent:
- Menunumber = MENU(0)
- Menuitem = MENU(1)
- MENU OFF:MENU
- ON Menunumber GOSUB File,Editmenu,Font,Size
- MENU ON
- RETURN
- File:
- ON Menuitem GOSUB Newitem,Openitem,Closeitem,Saveitem,SaveAs,Quit
- RETURN
- Editmenu:
- RETURN
- Font:
- FOR J=1 TO NumberofFonts
- Check(J)=1
- MENU 3,J,Check(J)
- NEXT J
- Check(Menuitem)=2
- MENU 3,Menuitem,Check(Menuitem)
- fontnum=Font(Menuitem)/128
- REALFONT! fontnum,9,fontstyle9
- REALFONT! fontnum,10,fontstyle10
- REALFONT! fontnum,12,fontstyle12
- REALFONT! fontnum,14,fontstyle14
- REALFONT! fontnum,18,fontstyle18
- REALFONT! fontnum,24,fontstyle24
- GOSUB Fontsizemenu
- CALL <0x2a,0xca54010> (Font(Menuitem)/128):' Font # is id%/128
- RETURN
- Size:
- FOR J=1 TO 6
- Sizecheck(J)=1:MENU 4,J,1
- NEXT J
- Sizecheck(Menuitem)= 2
- MENU 4,Menuitem,2
- IF Menuitem=1 THEN <0x12,0xca54010> (9)
- IF Menuitem=2 THEN <0x13,0xca54010> (10)
- IF Menuitem=3 THEN <0x13,0xca54010> (12)
- IF Menuitem=4 THEN <0x13,0xca54010> (14)
- IF Menuitem=5 THEN <0x13,0xca54010> (18)
- IF Menuitem=6 THEN <0x13,0xca54010> (24)
- RETURN
- Newitem:
- PRINT "New Selected"
- RETURN
- Openitem:
- PRINT "Open Selected"
- RETURN
- Closeitem:
- PRINT "Close Selected"
- RETURN
- Saveitem:
- PRINT "Save Selected"
- RETURN
- SaveAs:
- PRINT "SaveAs Selected"
- RETURN
- Quit:
- MENU RESET
- END
- 9000 changecursor! 4
- RESUME 10
- BEEP:PRINT "OOPS"
-